<?php require 'includes/security.php'; ?>
<?
include ('Connections/connection.php');


$id_stanza = $_GET['id_stanza'];


$query = "select * from options";

$resultID = mysql_query($query, $db) ;
$row = mysql_fetch_assoc($resultID);

$offset_x = $row["offset_x"];
$offset_y = $row["offset_y"];


$stanze = mysql_query("select * from stanze where id_stanza=".$id_stanza, $setroma) or die(mysql_error());
$row_stanza = mysql_fetch_assoc($stanze);

$sfondo_stanza = $row_stanza['Path'];



?>


<html>
<head>
<script src="framework/xml.js"></script>
</head>
<body>
<script type="text/javascript" src="scripts/wz_dragdrop.js"></script>




<div style="position:absolute; left: <? echo $offset_x;?>; top: <? echo $offset_y;?>">
<img src="userfiles/rooms/<?php echo $sfondo_stanza; ?>">
</div>

<script type="text/javascript">
var offset_x=<? echo $offset_x;?>;
var offset_y=<? echo $offset_y;?>;
</script>

<?php

$str_inizializzazione = "";

$query = "select * from oggetto where id_stanza=".$id_stanza;

$resultID = mysql_query($query, $db) ;



for($x = 0 ; $x < mysql_num_rows($resultID) ; $x++){
    $row = mysql_fetch_assoc($resultID);

?>

<div style="position: absolute;<? if ($row["X"] != "0") {?>
left:<?echo $row["X"]+$offset_x; ?>; top:<?echo $row["Y"]+$offset_y;?>; 
<?}?> ">

<img src="userfiles/images/<?echo $row["Immagine"]; ?>" name="oggetto<?echo $row["id_oggetto"]; ?>-" style="<?if ($row["W"] != "0") {?>
width:<?echo $row["W"]; ?>; height:<?echo $row["H"];?>; 
<?}?>">
</div>

<?
$str_inizializzazione .= "\"oggetto".$row["id_oggetto"]."-\"+RESIZABLE";
if ($x < mysql_num_rows($resultID)-1) $str_inizializzazione .= ",";
}
?>


<script type="text/javascript">
<!--

//SET_DHTML("1immagine-"+RESIZABLE);
SET_DHTML(<? echo $str_inizializzazione;?>);

//-->
</script>
</body>
</html>